import { symbolMatch } from '@/utils/symbolMatch'
const exchangeSymbol = (val) => {
  if (val === '1') {
    return symbolMatch('3')
  } else {
    return symbolMatch('4')
  }
}
// 提成配置Columns
export const configColumns = ctx => {
  return [
    {
      label: '档位',
      render: (h, row, index) => {
        return <span>档位 {index + 1}</span>
      }
    },
    {
      label: '销售单价(元/张)',
      render: (h, row) => {
        return [
          <span v-show={+row.sectionType === 1}>
            {row.minValue}元{exchangeSymbol(row.minOperationSymbol)}
            销售单价
            {symbolMatch(row.maxOperationSymbol)}
            {row.maxValue}元
          </span>,
          <span v-show={+row.sectionType === 2}>
            销售单价
            {symbolMatch(row.minOperationSymbol)}
            {row.minValue}元
          </span>
        ]
      }
    },
    {
      label: '业务提成',
      render: (h, row) => {
        return [<span>{row.proportion} %</span>]
      }
    },
    {
      label: '业务提成',
      hide: !ctx.isNotPointCard,
      render: (h, row) => {
        return [<span>{row.proportion} %</span>]
      }
    }
  ]
}
// 有效期规则
export const expiredColumns = ctx => {
  return [
    {
      label: '档位',
      render: (h, row, index) => {
        return <span>档位 {index + 1}</span>
      }
    },
    {
      label: '销售数量',
      render: (h, row) => {
        return [
          <span v-show={+row.sectionType === 1}>
            {row.minValue}张{exchangeSymbol(row.minOperationSymbol)}
            销售数量
            {symbolMatch(row.maxOperationSymbol)}
            {row.maxValue}张
          </span>,
          <span v-show={+row.sectionType === 2}>
            销售数量
            {symbolMatch(row.minOperationSymbol)}
            {row.minValue}张
          </span>
        ]
      }
    },
    {
      prop: 'day',
      label: '有效期天数'
    }
  ]
}
// 点卡-电影提成配置
export const movieColumns = ctx => {
  return [
    {
      label: '档位',
      render: (h, row, index) => {
        return <span>档位 {index + 1}</span>
      }
    },
    {
      label: '销售折扣(%)',
      render: (h, row) => {
        return [<span>{row.minValue} %</span>]
      }
    },
    {
      label: '固定提成(%)',
      render: (h, row) => {
        return [<span>{row.proportion} %</span>]
      }
    }
  ]
}
// 点卡-心选提成配置
export const heartColumns = ctx => {
  return [
    {
      label: '档位',
      render: (h, row, index) => {
        return <span>档位 {index + 1}</span>
      }
    },
    {
      label: '销售折扣',
      render: (h, row) => {
        return [
          <span v-show={+row.sectionType === 1}>
            {row.minValue}%{exchangeSymbol(row.minOperationSymbol)}
            销售折扣
            {symbolMatch(row.maxOperationSymbol)}
            {row.maxValue}%
          </span>,
          <span v-show={+row.sectionType === 2}>
            销售折扣
            {symbolMatch(row.minOperationSymbol)}
            {row.minValue}%
          </span>
        ]
      }
    },
    {
      label: '业务提成',
      render: (h, row) => {
        return [<span>{row.proportion} %</span>]
      }
    }
  ]
}
// 次卡-提成方案
export const secondCardColumns = ctx => {
  return [
    {
      prop: 'productCode',
      label: '产品编码'
    },
    {
      prop: 'businessTypeName',
      label: '业务类型'
    },
    {
      prop: 'name',
      label: '商品名称'
    },
    {
      prop: 'typeName',
      label: '产品类型'
    },
    {
      prop: 'parValue',
      label: '产品面值'
    },
    {
      prop: 'apartmentName',
      label: '可销售部门'
    },
    {
      label: '最低销售数量(张)',
      width: 200,
      render: (h, row, index) => {
        let item = ctx.infoData.proportionTimesData.filter(i => { return i.couponProductId === row.id })[0]
        return [
          <span>{item.minSaleNumberOperationSymbol === '1' ? '大于' : '大于等于'} {item.minSaleNumber}</span>
        ]
      }
    },
    {
      label: '单张卡含券张数(张)',
      width: 200,
      render: (h, row, index) => {
        let item = ctx.infoData.proportionTimesData.filter(i => { return i.couponProductId === row.id })[0]
        return [
          <span>{item.couponNumberOperationSymbol === '1' ? '大于' : '大于等于'} {item.couponNumber}</span>
        ]
      }
    }
  ]
}
